<div align="left" id="title_view_profile" >MON GALERIE
<a id="link1" class="active" href="#">ENVOYER PHOTO</a>
<div id="photo_upload" style="display: none;">
    <?php 
        $attributes = array('class' => 'upload_image', 'id' => 'upload_image');
        echo form_open_multipart('image/upload_image', $attributes);
    ?>
    <table align="center">
        <tr>
            <td><label for="image_upload">Photo : </label></td>
            <td><input type="file" name="userfile" size="20" /></td>
        </tr>
        <tr>
            <td><label for="image_title">Nom du Photo :</label></td>
            <td><input type="text" name="image_title" id="image_title" size="35"/></td>
        </tr>
        <tr>
            <td></td> <td colspan="2"><input type="submit" name="submit_upload_image" id="submit_upload_image" value="Partager"/></td>
        </tr>
    </table>

    </form>
</div>
</div>
<table align="center" width="90%">
   <tr>
        <td align="right">Total | <?php echo $total ?> </td>
    </tr>
</table>
<?php if($total >0){ ?>
    <?php echo form_open('image/delete_shared_images/') ?>
    <table width="90%" class="list" id="grid">
        <thead>
            <tr>
                <th><?php echo form_checkbox(array('name' => 'action_to_all', 'class' => 'grid-check-all')); ?></th>
                <th>Photos</th>
                <th colspan="2">Action</th>
            </tr>
        </thead>
        <?php foreach($image_galery as $aRow): ?>
            <?php $image_path = './upload_photo/thumbs/' . $aRow['image'];
                if (file_exists($image_path) && $aRow['image']!=null) {
                    $image_path = base_url() . 'upload_photo/thumbs/' . $aRow['image'];
                    $image_path_full = base_url() . 'upload_photo/thumbs/' . $aRow['image'];
                } 
                else {
                    $image_path = base_url() . 'assets/noimage.gif';
                    $image_path_full = base_url() . 'assets/noimage.gif';
                }
            ?>
            <tr>
                <td><?php echo form_checkbox('action_to[]',$aRow['id']);?></td>
                <td><img src="<?php echo $image_path ?>" alt="" border="0" width="80"></td>
                <td><a href="<?php echo site_url('image/set_private/'.$aRow['id']) ?>">Changer en photo privé</a></td>
            </tr>
            <?php endforeach; ?>
        <tr><td colspan="3"><input type="submit" value="Supprimer" name="delete"></td></tr>
    </table>
    <?php echo form_close() ?>
<?php } ?>
<div align="center"><?php echo $pagination;?></font></div>
<script type="text/javascript">
    (function($) {
        $(function() {
            $('.grid-check-all').click(function() {
                $('#grid').find("input[type='checkbox']").each(function () {
                    if($(".grid-check-all").is(":checked") && !$(this).is(':checked'))
                    {
                        $(this).click();
                    }
                    else if(!$(".grid-check-all").is(":checked") && $(this).is(':checked'))
                    {
                        $(this).click();
                    }
                }); 
            });
        });
    })(jQuery);
</script>
 